<cfquery name="getSurveyCategories" datasource="saratoga">
	select *, Left(Response, 50) as response50
	from survey_categories
</cfquery>
<cfset noMatches = 0>
<cfset multiMatches = 0>
<cfoutput>
<cfloop query="getSurveyCategories">
	<cfset response50 = getSurveyCategories.response50 />
	<cfquery name="GetRespondent" datasource="saratoga">
		select RespondentID, Left(works_well, 50) as worksWell50, Left(does_not_work_well, 50) as doesNotWorkWell50
		from survey_data
		where Left(works_well, 50) = '#response50#' or Left(does_not_work_well, 50) = '#response50#'
	</cfquery>
	<cfset response50F = Replace(Replace(response50, """", "", "all"), "'", "", "all") />
	<cfset worksWell50F = Replace(Replace(GetRespondent.worksWell50, """", "", "all"), "'", "", "all") />
	<cfset doesNotWorkWell50F = Replace(Replace(GetRespondent.doesNotWorkWell50, """", "", "all"), "'", "", "all") />
	<cfif GetRespondent.RecordCount eq 0>
		<p>No match - #response# - #Respondent_ID#</p>
		<cfset noMatches = noMatches + 1>
	<cfelseif GetRespondent.RecordCount gt 1>
		<p>Multiple matches - #response#</p>
		<cfset multiMatches = multiMatches + 1>
	<cfelse>
		<!--- <cfquery name="UpdateCategory" datasource="saratoga">
			update survey_categories
			set Respondent_ID = #GetRespondent.RespondentID#
			where Left(Response, 50) = '#GetRespondent.worksWell50#' or Left(Response, 50) = '#GetRespondent.doesNotWorkWell50#'
		</cfquery> --->
	</cfif>
	
	
</cfloop>
<h1>No match: #noMatches#</h1>
<h1>Multi-match: #multiMatches#</h1>
</cfoutput>

<!--- <cfloop query="getSurvey">
	<cfquery name="updateSurvey" datasource="saratoga">
		update survey_data
		set works_well = '#Replace(works_well, """", "", "all")#',
		does_not_work_well = '#Replace(does_not_work_well, """", "", "all")#'
		where respondentid = #respondentid#
	</cfquery>
</cfloop> --->